<template>
	<view class="container">
		<jyf-parser :html="detail.articleContent" ref="article"></jyf-parser>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: '',
				detail: {},
			}
		},
		methods: {
			// 获取文章详情
			async getArticleDetail(id) {
				let res = await this.$fetch(this.$api.get_article_by_id, {
					id: id
				}, 'POST')
				console.log(res.data.articleContent, '返回内容');
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				this.detail = res.data
				uni.setNavigationBarTitle({
					title: this.detail.articleTitle
				})
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getArticleDetail(options.id)
		},
		onShareAppMessage() {
			if (uni.getStorageSync('userType') == 1) {
				return {
					title: "足不出户，免费招工",
					desc: "线上招募零工，工价透明，免费使用",
					path: `/pages/start-n/start-n`,
					imageUrl: 'https://images.linglinggong.net/static/employer-share.jpg',
					success: res => {}
				}
			} else {
				return {
					title: "在家找日结兼职，工种齐全",
					desc: "免费使用，提前在家找日结兼职",
					path: `/pages/start-n/start-n`,
					imageUrl: 'https://images.linglinggong.net/static/employee-share.jpg',
					success: res => {}
				}
			}
		},
	}
</script>
<style lang="less">
	.container {
		padding: 30rpx;
		height: calc(100vh - 60rpx);
		background-color: #FFFFFF;
	}

	video::-webkit-media-controls-fullscreen-button {
		display: none;
	}
</style>